package li.brauch.semesterarbeit.radio;

import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.RegistryFactory;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;

public class RadioPreferenceInitializer extends AbstractPreferenceInitializer {
	
	public RadioPreferenceInitializer() {
		
	}

	@Override
	public void initializeDefaultPreferences() {
		
		IExtensionRegistry registry = RegistryFactory.getRegistry();
		IExtensionPoint extensionPoint = registry.getExtensionPoint("li.brauch.semesterarbeit.radio.IRadio");
		
		IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
		
		for (IConfigurationElement element : elements) {
			// First element is the default element
			RadioPlugin.getDefault().getPreferenceStore().setDefault("radioImpl", element.getAttribute("class"));
			break;
		}
		
		
		RadioPlugin.getDefault().getPreferenceStore().setDefault("shopURL", "http://www.exlibris.ch/search.aspx?clearfilter=1&st=pr&sartikelgruppe_pr=02&Artist=${artist}&AlbumName=${album}");
		
	}

}
